export class EEGFatigueCalculator {
    constructor(sampleRate) {
      this.sampleRate = sampleRate;
      this.dataBuffer = [];
      this.bufferSize = sampleRate * 5; // 5秒数据
    }
  
    addDataPoint(value) {
      this.dataBuffer.push(value);
      if (this.dataBuffer.length > this.bufferSize) {
        this.dataBuffer.shift(); // 保持缓冲区大小
      }
      
      // 简化的疲劳计算逻辑（实际应用中可能需要更复杂的算法）
      const avg = this.dataBuffer.reduce((sum, v) => sum + v, 0) / this.dataBuffer.length;
      return Math.min(100, Math.max(0, avg * 0.5)); // 示例映射函数
    }
  }
  
  export class PPGFatigueCalculator {
    constructor(sampleRate) {
      this.sampleRate = sampleRate;
    }
  
    processPPG(redData, heartRate) {
      // 简化的PPG疲劳计算（实际应用中可能需要更复杂的算法）
      return Math.min(100, Math.max(0, (redData % 80 + heartRate % 80) / 1.6));
    }
  }